home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / RAVESystem.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  13.6 KB  |  320 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        RAVESystem.h
  3.  
  4.      Contains:    Interfaces needed when building RAVE engines                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __RAVESYSTEM__
  18. #define __RAVESYSTEM__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21. #include <ConditionalMacros.h>
  22. #endif
  23. #ifndef __RAVE__
  24. #include <RAVE.h>
  25. #endif
  26.  
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=power
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50. #if PRAGMA_ENUM_ALWAYSINT
  51.     #pragma enumsalwaysint on
  52. #elif PRAGMA_ENUM_OPTIONS
  53.     #pragma option enum=int
  54. #elif PRAGMA_ENUM_PACK
  55.     #if __option(pack_enums)
  56.         #define PRAGMA_ENUM_PACK__RAVESYSTEM__
  57.     #endif
  58.     #pragma options(!pack_enums)
  59. #endif
  60.  
  61.  
  62. /************************************************************************************************
  63.  *
  64.  * Typedefs of texture/bitmap method functions provided by the drawing engine.
  65.  *
  66.  ***********************************************************************************************/
  67. /* TQAColorTableNew    parameter descriptions */
  68. /* TQAColorTableType    pixelType            Depth, color space, etc. */
  69. /* void                    *pixelData            lookup table entries in pixelType format */
  70. /* long                    transparentIndex    boolean, false means no transparency, true means index 0 is transparent */
  71. /* TQAColorTable        **newTable            (Out) Newly created TQAColorTable */
  72. typedef CALLBACK_API_C( TQAError , TQAColorTableNew )(TQAColorTableType pixelType, void *pixelData, long transparentIndex, TQAColorTable **newTable);
  73. /* TQAColorTableDelete    parameter descriptions */
  74. /* TQAColorTable        *colorTable        Previously allocated by QAColorTableNew() */
  75. typedef CALLBACK_API_C( void , TQAColorTableDelete )(TQAColorTable *colorTable);
  76. /* TQATextureNew    parameter descriptions */
  77. /*    unsigned long        flags                Mask of kQATexture_xxx flags */
  78. /*    TQAImagePixelType    pixelType            Depth, color space, etc. */
  79. /*    const TQAImage        images[]            Image(s) for texture */
  80. /*    TQATexture            **newTexture        (Out) Newly created TQATexture, or NULL on error */
  81. typedef CALLBACK_API_C( TQAError , TQATextureNew )(unsigned long flags, TQAImagePixelType pixelType, const TQAImage images[], TQATexture **newTexture);
  82. /* TQATextureDetach    parameter descriptions */
  83. /*    TQATexture            *texture            Previously allocated by QATextureNew() */
  84. typedef CALLBACK_API_C( TQAError , TQATextureDetach )(TQATexture *texture);
  85. /* TQATextureDelete    parameter descriptions */
  86. /*    TQATexture            *texture            Previously allocated by QATextureNew() */
  87. typedef CALLBACK_API_C( void , TQATextureDelete )(TQATexture *texture);
  88. /* TQATextureBindColorTable    parameter descriptions */
  89. /*    TQATexture            *texture            Previously allocated by QATextureNew() */
  90. /*    TQAColorTable        *colorTable            Previously allocated by QAColorTableNew() */
  91. typedef CALLBACK_API_C( TQAError , TQATextureBindColorTable )(TQATexture *texture, TQAColorTable *colorTable);
  92. /* TQABitmapNew    parameter descriptions */
  93. /*    unsigned long        flags                Mask of kQABitmap_xxx flags */
  94. /*    TQAImagePixelType    pixelType            Depth, color space, etc. */
  95. /*    const TQAImage        *image                Image */
  96. /*    TQABitmap            **newBitmap            (Out) Newly created TQABitmap, or NULL on error */
  97. typedef CALLBACK_API_C( TQAError , TQABitmapNew )(unsigned long flags, TQAImagePixelType pixelType, const TQAImage *image, TQABitmap **newBitmap);
  98. /* TQABitmapDetach    parameter descriptions */
  99. /*    TQABitmap            *bitmap            Previously allocated by QABitmapNew() */
  100. typedef CALLBACK_API_C( TQAError , TQABitmapDetach )(TQABitmap *bitmap);
  101. /* TQABitmapDelete    parameter descriptions */
  102. /*    TQABitmap            *bitmap            Previously allocated by QABitmapNew() */
  103. typedef CALLBACK_API_C( void , TQABitmapDelete )(TQABitmap *bitmap);
  104. /* TQABitmapBindColorTable    parameter descriptions */
  105. /*    TQABitmap            *bitmap            Previously allocated by QABitmapNew() */
  106. /*    TQAColorTable        *colorTable        Previously allocated by QAColorTableNew() */
  107. typedef CALLBACK_API_C( TQAError , TQABitmapBindColorTable )(TQABitmap *bitmap, TQAColorTable *colorTable);
  108. /************************************************************************************************
  109.  *
  110.  * Typedefs of private (system-only) functions provided by the drawing engine.
  111.  *
  112.  * The TQADrawPrivateNew function returns a TQADrawPrivate *, which points to the
  113.  * engine-specific private data created for the context. (TQADrawPrivate is a dummy
  114.  * type which is then cast to the correct engine-specific datatype by the engine code.)
  115.  *
  116.  * The TQADrawPrivateDelete function deletes the engine-specific private data.
  117.  *
  118.  * TQAStorePrivateNew and TQAStorePrivateDelete provide the same function as QADrawPrivateNew
  119.  * and TQADrawPrivateDelete, but for the texture and bitmap storage context.
  120.  *
  121.  * TQADrawMethodGet and TQAStoreMethodGet are called by the RAVE manager to retrieve
  122.  * the method pointers for a drawing engine.
  123.  *
  124.  * The TQAEngineCheckDevice function returns TRUE if the engine can render to the
  125.  * indicated GDevice.
  126.  *
  127.  ***********************************************************************************************/
  128. /* TQADrawPrivateNew    parameter descriptions */
  129. /*    TQADrawContext        *newDrawContext        Draw context to initialize */
  130. /*    const TQADevice        *device                Target device */
  131. /*    const TQARect        *rect                Target rectangle (device coordinates) */
  132. /*    const TQAClip        *clip                2D clip region (or NULL) */
  133. /*    unsigned long        flags                Mask of kQAContext_xxx */
  134. typedef CALLBACK_API_C( TQAError , TQADrawPrivateNew )(TQADrawContext *newDrawContext, const TQADevice *device, const TQARect *rect, const TQAClip *clip, unsigned long flags);
  135. /* TQADrawPrivateDelete    parameter descriptions */
  136. /*    TQADrawPrivate        *drawPrivate        Private context data to delete */
  137. typedef CALLBACK_API_C( void , TQADrawPrivateDelete )(TQADrawPrivate *drawPrivate);
  138. /* TQAEngineCheckDevice    parameter descriptions */
  139. /*    const TQADevice        *device            Target device */
  140. typedef CALLBACK_API_C( TQAError , TQAEngineCheckDevice )(const TQADevice *device);
  141. /* TQAEngineGestalt    parameter descriptions */
  142. /*    TQAGestaltSelector    selector            Gestalt parameter being requested */
  143. /*    void                *response            Buffer that receives response */
  144. typedef CALLBACK_API_C( TQAError , TQAEngineGestalt )(TQAGestaltSelector selector, void *response);
  145. /************************************************************************************************
  146.  *
  147.  * The TQAEngineMethod union is used to represent a single engine method (it's a
  148.  * parameter to QAEngineGetMethod). TQAEngineMethodTag identifies which method is being
  149.  * requested.
  150.  *
  151.  ***********************************************************************************************/
  152.  
  153. union TQAEngineMethod {
  154.     TQADrawPrivateNew                 drawPrivateNew;                /* Method: Create a private draw context */
  155.     TQADrawPrivateDelete             drawPrivateDelete;            /* Method: Delete a private draw context */
  156.     TQAEngineCheckDevice             engineCheckDevice;            /* Method: Check a device for drawing */
  157.     TQAEngineGestalt                 engineGestalt;                /* Method: Gestalt */
  158.     TQATextureNew                     textureNew;                    /* Method: Create a texture (load is non-blocking) */
  159.     TQATextureDetach                 textureDetach;                /* Method: Complete load of a texture (blocking) */
  160.     TQATextureDelete                 textureDelete;                /* Method: Delete a texture */
  161.     TQABitmapNew                     bitmapNew;                    /* Method: Create a bitmap (load is non-blocking)  */
  162.     TQABitmapDetach                 bitmapDetach;                /* Method: Complete load of a bitmap (blocking) */
  163.     TQABitmapDelete                 bitmapDelete;                /* Method: Delete a bitmap */
  164.     TQAColorTableNew                 colorTableNew;                /* Method: Create a new color table */
  165.     TQAColorTableDelete             colorTableDelete;            /* Method: Create a new color table */
  166.     TQATextureBindColorTable         textureBindColorTable;        /* Method: Bind a CLUT to a texture */
  167.     TQABitmapBindColorTable         bitmapBindColorTable;        /* Method: Bind a CLUT to a bitmap */
  168. };
  169. typedef union TQAEngineMethod            TQAEngineMethod;
  170.  
  171. enum TQAEngineMethodTag {
  172.     kQADrawPrivateNew            = 0,
  173.     kQADrawPrivateDelete        = 1,
  174.     kQAEngineCheckDevice        = 2,
  175.     kQAEngineGestalt            = 3,
  176.     kQATextureNew                = 4,
  177.     kQATextureDetach            = 5,
  178.     kQATextureDelete            = 6,
  179.     kQABitmapNew                = 7,
  180.     kQABitmapDetach                = 8,
  181.     kQABitmapDelete                = 9,
  182.     kQAColorTableNew            = 10,
  183.     kQAColorTableDelete            = 11,
  184.     kQATextureBindColorTable    = 12,
  185.     kQABitmapBindColorTable        = 13
  186. };
  187. typedef enum TQAEngineMethodTag TQAEngineMethodTag;
  188.  
  189. /************************************************************************************************
  190.  *
  191.  * QARegisterEngine() registers a new engine. This is called at boot time by the drawing engine
  192.  * initialization code to register itself with the system. This call takes only one parameter,
  193.  * the engine's function that allows the manager to request the other methods.
  194.  *
  195.  ***********************************************************************************************/
  196. /* TQAEngineGetMethod    parameter descriptions */
  197. /*    TQAEngineMethodTag        methodTag                Method being requested */
  198. /*    TQAEngineMethod            *method                    (Out) Method */
  199. typedef CALLBACK_API_C( TQAError , TQAEngineGetMethod )(TQAEngineMethodTag methodTag, TQAEngineMethod *method);
  200. /* QARegisterEngine    parameter descriptions */
  201. /*    TQAEngineGetMethod        engineGetMethod        Engine's getMethod method */
  202. EXTERN_API_C( TQAError )
  203. QARegisterEngine                (TQAEngineGetMethod     engineGetMethod);
  204.  
  205. /************************************************************************************************
  206.  *
  207.  * The TQADrawMethod union is used to represent a single draw context method (it's a
  208.  * parameter to QARegisterDrawMethod). TQADrawMethodTag identifies which method is being
  209.  * passed.
  210.  *
  211.  ***********************************************************************************************/
  212.  
  213. union TQADrawMethod {
  214.     TQASetFloat                     setFloat;                    /* Method: Set a float state variable */
  215.     TQASetInt                         setInt;                        /* Method: Set an unsigned long state variable */
  216.     TQASetPtr                         setPtr;                        /* Method: Set an unsigned long state variable */
  217.     TQAGetFloat                     getFloat;                    /* Method: Get a float state variable */
  218.     TQAGetInt                         getInt;                        /* Method: Get an unsigned long state variable */
  219.     TQAGetPtr                         getPtr;                        /* Method: Get an pointer state variable */
  220.     TQADrawPoint                     drawPoint;                    /* Method: Draw a point */
  221.     TQADrawLine                     drawLine;                    /* Method: Draw a line */
  222.     TQADrawTriGouraud                 drawTriGouraud;                /* Method: Draw a Gouraud shaded triangle */
  223.     TQADrawTriTexture                 drawTriTexture;                /* Method: Draw a texture mapped triangle */
  224.     TQADrawVGouraud                 drawVGouraud;                /* Method: Draw Gouraud vertices */
  225.     TQADrawVTexture                 drawVTexture;                /* Method: Draw texture vertices */
  226.     TQADrawBitmap                     drawBitmap;                    /* Method: Draw a bitmap */
  227.     TQARenderStart                     renderStart;                /* Method: Initialize for rendering */
  228.     TQARenderEnd                     renderEnd;                    /* Method: Complete rendering and display */
  229.     TQARenderAbort                     renderAbort;                /* Method: Abort any outstanding rendering (blocking) */
  230.     TQAFlush                         flush;                        /* Method: Start render of any queued commands (non-blocking) */
  231.     TQASync                         sync;                        /* Method: Wait for completion of all rendering (blocking) */
  232.     TQASubmitVerticesGouraud         submitVerticesGouraud;        /* Method: Submit Gouraud vertices for trimesh */
  233.     TQASubmitVerticesTexture         submitVerticesTexture;        /* Method: Submit Texture vertices for trimesh */
  234.     TQADrawTriMeshGouraud             drawTriMeshGouraud;            /* Method: Draw a Gouraud triangle mesh */
  235.     TQADrawTriMeshTexture             drawTriMeshTexture;            /* Method: Draw a Texture triangle mesh */
  236.     TQASetNoticeMethod                 setNoticeMethod;            /* Method: Set a notice method */
  237.     TQAGetNoticeMethod                 getNoticeMethod;            /* Method: Get a notice method */
  238. };
  239. typedef union TQADrawMethod                TQADrawMethod;
  240.  
  241. enum TQADrawMethodTag {
  242.     kQASetFloat                    = 0,
  243.     kQASetInt                    = 1,
  244.     kQASetPtr                    = 2,
  245.     kQAGetFloat                    = 3,
  246.     kQAGetInt                    = 4,
  247.     kQAGetPtr                    = 5,
  248.     kQADrawPoint                = 6,
  249.     kQADrawLine                    = 7,
  250.     kQADrawTriGouraud            = 8,
  251.     kQADrawTriTexture            = 9,
  252.     kQADrawVGouraud                = 10,
  253.     kQADrawVTexture                = 11,
  254.     kQADrawBitmap                = 12,
  255.     kQARenderStart                = 13,
  256.     kQARenderEnd                = 14,
  257.     kQARenderAbort                = 15,
  258.     kQAFlush                    = 16,
  259.     kQASync                        = 17,
  260.     kQASubmitVerticesGouraud    = 18,
  261.     kQASubmitVerticesTexture    = 19,
  262.     kQADrawTriMeshGouraud        = 20,
  263.     kQADrawTriMeshTexture        = 21,
  264.     kQASetNoticeMethod            = 22,
  265.     kQAGetNoticeMethod            = 23
  266. };
  267. typedef enum TQADrawMethodTag TQADrawMethodTag;
  268.  
  269. /************************************************************************************************
  270.  *
  271.  * System call to register a new method for an engine. This is called during the engine's
  272.  * draw private new functions (to set the initial value of the draw methods), and possibly
  273.  * at other times when the engine needs to change a draw method.
  274.  *
  275.  ***********************************************************************************************/
  276. /* QARegisterDrawMethod    parameter descriptions */
  277. /*    TQADrawContext            *drawContext            Draw context in which to set method */
  278. /*    TQADrawMethodTag        methodTag                Method to set */
  279. /*    TQADrawMethod            method                    Method */
  280. EXTERN_API_C( TQAError )
  281. QARegisterDrawMethod            (TQADrawContext *        drawContext,
  282.                                  TQADrawMethodTag         methodTag,
  283.                                  TQADrawMethod             method);
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292. #if PRAGMA_ENUM_ALWAYSINT
  293.     #pragma enumsalwaysint reset
  294. #elif PRAGMA_ENUM_OPTIONS
  295.     #pragma option enum=reset
  296. #elif defined(PRAGMA_ENUM_PACK__RAVESYSTEM__)
  297.     #pragma options(pack_enums)
  298. #endif
  299.  
  300. #if PRAGMA_STRUCT_ALIGN
  301.     #pragma options align=reset
  302. #elif PRAGMA_STRUCT_PACKPUSH
  303.     #pragma pack(pop)
  304. #elif PRAGMA_STRUCT_PACK
  305.     #pragma pack()
  306. #endif
  307.  
  308. #ifdef PRAGMA_IMPORT_OFF
  309. #pragma import off
  310. #elif PRAGMA_IMPORT
  311. #pragma import reset
  312. #endif
  313.  
  314. #ifdef __cplusplus
  315. }
  316. #endif
  317.  
  318. #endif /* __RAVESYSTEM__ */
  319.  
  320.